<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
          width: 800px;
          margin: 200px auto;
          text-align: center;
        }
        .box h2{
            color: gold;
          font-size: 55px;
          font-weight: 800;
        }
        .box input{
          outline: none;
          border: none;
          background: pink;
          color: white;
          width: 100px;
          height: 50px;
          font-size: 15px;
          font-weight: 600;
        }
      </style>
    </head>
    <body>
      <div class="box">
        <h2 id="res">请点击下面的按钮，开始抽奖！</h2>
        <input type="button" value="点击开始" id="btn">
      </div>
      <script>
       var btn=  document.getElementById("btn");
       var res=  document.getElementById("res");
        var student=["联名钥匙扣","联名风衣刺客信条","小埋明信片","康娜酱抱枕","少女手机壳","萝莉卫衣","穹妹勋章","动漫炫彩印刷笔","卡通水杯粉","联名戒指","动漫自选海报10张","联名背包可莉款","腾讯视频vip一月","游戏体验皮肤*7天"] 
        var flag=true;
        var timer=null;
        function getRandom(max,min){ 
         return Math.round(Math.random()*(max-min)+min);
        }
        btn.onclick=function(){
          if(flag){
            timer= setInterval(function(){
             var index= getRandom(student.length-1,0) ;
             res.innerHTML=student[index];
            },10);
             
            btn.value="点击结束";
            flag=false;
          }else{
            clearInterval(timer);
            btn.value="点击开始";
            flag=true;
          }   
        }
        
      </script>
    </body>
    </html>